<?php
  class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
  	public function _initAutoload(){
  		$front = Zend_Controller_Front::getInstance(); //??
  		$front->registerPlugin(
  			new Zend_Controller_Plugin_ErrorHandler(array(
  					'module' 		=> 'error',
  					'controller' 	=> 'error',
  					'action'		=> 'error'
  				)));
  	}
    protected function _initDb(){
        $dbOptionds = $this->getOption('resources');
        $dbOptionds = $dbOptionds['db'];
        
        // Set up db
        $db = Zend_Db::factory($dbOptionds['adapter'], $dbOptionds['params']);
        $db->setFetchMode(Zend_Db::FETCH_ASSOC);
        $db->query("SET NAMES 'utf8'");
        $db->query("SET CHARACTER SET 'utf8'");
        
        Zend_Registry::set('connectDB', $db);
        // Khi thiet la che do nay model moi co the su dung duoc
        Zend_Db_Table::setDefaultAdapter($db);
        Zend_Db_Table_Abstract::setDefaultAdapter($db);
        // return it, so that it can be stored in bootstrap
        return $db;
        
    }
  }
?>